package com.qy139.auth.controller;


import com.qy139.auth.service.ITabRoleService;
import com.qy139.entity.TabRole;
import com.qy139.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuhaochen
 * @since 2021-12-01
 */
@RestController
@RequestMapping("/tab-role")
public class TabRoleController {
    @Resource
    private ITabRoleService tabRoleService;

    @GetMapping("/findAllRoles")
    public Result getAllRole(){
        return new Result(tabRoleService.list());
    }

    @PostMapping("/addRole")
    public Result add(@RequestBody TabRole tabRole){
        return new Result(tabRoleService.save(tabRole));
    }

    @GetMapping("uniqueCheck")
    public Result uniqueCheck(TabRole tabRole){
        return tabRoleService.uniqueCheck(tabRole);
    }

}

